package cn.tedu.zblogs.home.controller;


import cn.tedu.base.response.JsonResult;
import cn.tedu.zblogs.home.pojo.VO.ArticleEsVO;
import cn.tedu.zblogs.home.pojo.VO.ArticleVO;
import cn.tedu.zblogs.home.pojo.VO.TagVO;
import cn.tedu.zblogs.home.pojo.dto.ArticleDTO;
import cn.tedu.zblogs.home.service.EsService;
import cn.tedu.zblogs.home.service.HomeService;
import cn.tedu.zblogs.home.utils.CacheUtil;
import cn.tedu.zblogs.home.utils.EsUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;

import java.io.IOException;
import java.io.StringReader;
import java.text.SimpleDateFormat;
import java.util.*;

@Slf4j
@Api(tags = "定时统计系统")
@RestController
@RequestMapping("/home")
// 解决跨域问题  使用网关的时候需要注释掉
//@CrossOrigin
public class InsertDataStatisticsController {
    @Autowired
    private HomeService homeService;

    @Autowired
    private EsService esService;

//    @Autowired
//    private EsUtil esUtil;

    @ApiOperation(value = "插入定时统计系统")
    @GetMapping("statistics/select")
    public JsonResult insertDataStatistics () {
        log.debug("插入定时统计系统");
        homeService.InsertDataStatistics();
        TagVO InsertDataStatistics= new TagVO();
       return  JsonResult.ok(InsertDataStatistics);
    }


}